home *** CD-ROM | disk | FTP | other *** search
/ Nebula 2 / Nebula Two.iso / SourceCode / GameKit / Headers / gamekit / HighScoreSlot.h < prev    next >
Text File  |  1995-06-12  |  3KB  |  63 lines

  1. // HighScoreSlot.h -- this is a slot in the table and holds all the info
  2. //    about a particular high score.  Future versions may hold more data
  3. //    and the only fields that *must* have valid data are pos and score.
  4.  
  5. // This class makes use of the DAYMiscKit which contains several classes
  6. // that are of general use and not gamekit specific.  (DAYString, DAYTime,
  7. // and DAYStopwatch are used by HighScoreSlot.)
  8.  
  9. #import <appkit/appkit.h>
  10.  
  11. #define GKHighScoreSlot_VERSION 1
  12.  
  13. @interface HighScoreSlot:Object <NXTransport>
  14. {
  15.     // The vars simply hold data about an instance of game play.
  16.     // This objects holds a record of info for easy transport over
  17.     // the net and easy saving and reading to and from files.
  18.     int finalScore, startLevel, endLevel;    // basic info about game
  19.     id startTime, endTime;    // DAYTime (DAYMiscKit)
  20.     id elapsedTime;            // DAYStopwatch (DAYMiscKit)
  21.     id playerName, userName, machineName; // DAYString (DAYMiscKit)
  22. }
  23.  
  24. + initialize;            // sets the version number of the class
  25. - init;                    // same as [xxx initName:"Nobody" score:0];
  26. - initName:(const char *)initName    // another initializer, same as
  27.         score:(int)initScore;    // [xxx initName:"Nobody" score:0 endLevel:0];
  28. - initName:(const char *)initName score:(int)initScore
  29.         endLevel:(int)initLevel;    // designated initializer
  30.  
  31. - dumpToLog:aLogFile;    // used by server when logging
  32.  
  33. // The following methods access value of the slot.
  34. - (const char *)playerName;        // the scoring player's name
  35. - (const char *)userName;        // the scoring player's login name
  36. - (const char *)machineName;    // the machine used to play the game
  37. - (int)finalScore;                // score achieved
  38. - (int)startLevel;                // level game began at
  39. - (int)endLevel;                // level game reached
  40. - startTime;                    // Date and time when game began
  41. - endTime;                        // Date and time when game finished
  42. - elapsedTime;                    // Length of time game play was actually in
  43.                                 // progress (ie. excluding paused periods)
  44.  
  45. // The following methods change the values of the slot.  All return self.
  46. - setPlayerName:(const char *)t;
  47. - setUserName:(const char *)t;
  48. - setMachineName:(const char *)t;
  49. - setFinalScore:(int)t;
  50. - setStartLevel:(int)t;
  51. - setEndLevel:(int)t;
  52. - setStartTime:aTime;    // aTime is _not_ copied, so don't free it!
  53. - setEndTime:aTime;        // rather, aTime will be freed by the slot
  54. - setElapsedTime:aTime;    // so treat it as "handing off" the object
  55. - (BOOL)isAbove:aSlot;    // return YES if should be before aSlot in the table
  56.  
  57. // for archiving to/from a file
  58. - read:(NXTypedStream *)stream;
  59. - write:(NXTypedStream *)stream;
  60. - copy;
  61.  
  62. @end        
  63.